<?xml version="1.0" encoding="UTF-8"?>
<!-- Copyright 2008 XBRL International. All Rights Reserved. -->
<?xml-stylesheet type="text/xsl" href="../stylesheets/conformanceFunction.xsl"?>
<testcase
  xmlns="http://xbrl.org/2008/conformance"
  xmlns:reg="http://xbrl.org/2008/registry"
  xmlns:fcn="http://xbrl.org/2008/function"
  xmlns:cfcn="http://xbrl.org/2008/conformance/function"
  xmlns:xbrli="http://www.xbrl.org/2003/instance"
  xmlns:xhtml="http://www.w3.org/1999/xhtml"
  xmlns:xfi="http://www.xbrl.org/2008/function/instance"
  xmlns:xfie="http://www.xbrl.org/2008/function/instance/error"
  xmlns:xqt-err="http://www.w3.org/2005/xqt-errors"
  xmlns:xs="http://www.w3.org/2001/XMLSchema"
  xmlns:concept="http://xbrl.org/formula/conformance/example" 
  xmlns:xlink="http://www.w3.org/1999/xlink"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  xsi:schemaLocation="
  http://xbrl.org/2008/registry ../schemas/registry.xsd
  http://xbrl.org/2008/function ../schemas/function.xsd
  http://xbrl.org/2008/conformance ../schemas/conformance.xsd
  http://xbrl.org/2008/conformance/function ../schemas/conformanceFunction.xsd
  ">
  <owners>
    <reg:owner id="herm">
      <reg:name>Herm Fischer</reg:name>
      <reg:affiliation>UBMatrix / Mark V Systems</reg:affiliation>
      <reg:email>fischer@markv.com</reg:email>
     <reg:assumedOwnership moment="2008-02-19T00:00:00" />
    </reg:owner>
  </owners>

  <number>80153</number>

  <name>xfi:precision</name>

  <documentation>
    <xhtml:p>
      Test the functionality of the xfi:precision function.
    </xhtml:p>
  </documentation>

  <reference xlink:type="simple" xlink:href="http://www.xbrl.org/Specification/XF-PWD-2006-12-07.htm#_Toc152670664"/>

  <variation id="V-01">
    <name>Returns error for a non-numeric concept</name>
    <documentation>
      <xhtml:p>
        The concept has an xbrli:stringItemType data type.
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V01" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V01">
        xfi:precision( /xbrli:xbrl/concept:c1[1] )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xfie:ItemIsNotNumeric</error>
    </outputs>
  </variation>

  <variation id="V-02">
    <name>Precision is 3 for 400, reported as decimals 0</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V02" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V02">
        xfi:precision( /xbrli:xbrl/concept:c2[1] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 3
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-03">
    <name>Precision is INF for 400, reported as decimals INF</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V03" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V03">
        xfi:precision( /xbrli:xbrl/concept:c2[2] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:string and $result eq 'INF'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-04">
    <name>Precision is 0 for 400, reported at precision 0</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V04" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V04">
        xfi:precision( /xbrli:xbrl/concept:c2[3] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 0
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-05">
    <name>Precision is 4 for 400, reported at precision 4</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V05" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V05">
        xfi:precision( /xbrli:xbrl/concept:c2[4] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 4
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-06">
    <name>Returns "INF" for a fraction concept</name>
    <documentation>
      <xhtml:p>
        The concept has an xs:fractionItemType data type.
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V06" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V06">
        xfi:precision( /xbrli:xbrl/concept:c3[1] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:string and $result eq 'INF'
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-07">
    <name>Returns error for a tuple concept</name>
    <documentation>
      <xhtml:p>
        The concept is a tuple.
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V07" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V07">
        xfi:precision( /xbrli:xbrl/concept:c4[1] )
      </cfcn:call>
    </inputs>
    <outputs>
      <error>xqt-err:XPTY0004</error>
    </outputs>
  </variation>

  <variation id="V-11">
    <name>Xbrl spec 2.1 example 13 line 1</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V11" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V11">
        xfi:precision( /xbrli:xbrl/concept:c2[5] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 5
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-12">
    <name>Xbrl spec 2.1 example 13 line 2</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V12" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V12">
        xfi:precision( /xbrli:xbrl/concept:c2[6] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 5
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-13">
    <name>Xbrl spec 2.1 example 13 line 3</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V13" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V13">
        xfi:precision( /xbrli:xbrl/concept:c2[7] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 5
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-14">
    <name>Xbrl spec 2.1 example 13 line 4</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V14" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V14">
        xfi:precision( /xbrli:xbrl/concept:c2[8] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 5
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-15">
    <name>Xbrl spec 2.1 example 13 line 5</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V15" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V15">
        xfi:precision( /xbrli:xbrl/concept:c2[9] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 3
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-16">
    <name>Xbrl spec 2.1 example 13 line 6</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V16" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V16">
        xfi:precision( /xbrli:xbrl/concept:c2[10] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 1
      </cfcn:test>
    </outputs>
  </variation>

  <variation id="V-17">
    <name>Xbrl spec 2.1 example 13 line 7</name>
    <documentation>
      <xhtml:p>
      </xhtml:p>
     </documentation>
    <inputs>
      <schema xlink:type="simple" xlink:href="precision-test.xsd"/>
      <instance readMeFirst="true" id="V17" xlink:type="simple" xlink:href="precision-instance.xml"/>
      <cfcn:call file="V17">
        xfi:precision( /xbrli:xbrl/concept:c2[11] )
      </cfcn:call>
    </inputs>
    <outputs>
      <cfcn:test>
         $result instance of xs:nonNegativeInteger and $result eq 0
      </cfcn:test>
    </outputs>
  </variation>

  <revisions>
    <reg:revision on="2008-02-19T00:00:00" by="herm">
      <xhtml:p>
        Created the test case.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2008-04-05T00:00:00" by="herm">
      <xhtml:p>
        Corrected implied precision examples, added Example 13 from Spec v2.1.
      </xhtml:p>
    </reg:revision>
    <reg:revision on="2011-06-22T00:00:00" by="herm">
      <xhtml:p>
        Added xmlns:xs.
      </xhtml:p>
    </reg:revision>
  </revisions>

</testcase>

